import axios from "axios";

let url = "http://172.10.61.43:8080/xopspring-web/rest"

const sendPost = function (method, params) {
    return axios.post(
        url,
        {
            "loc": "zh_CN",
            "ver": "1.0.0",
            "method": method,
            "tenantid": 0,
            "sign": "DF921B6580E477B9E51A164B20306668",
            "appkey": "XRLOGIN",
            "secret": "SeBon02D65k08cMPf",
            "extras": {
                "token": "MOB-2B6860781094AEE8EF8287DA35A283671656898037177"
            },
            "hotelid": "XR",
            "params": [
                params
            ],
            "ts": 1656898043000
        }
    )
}


/**
 * DB018 获取年支付数据
 */
export const getListmouthpay = function (params) {
    let {transYear} = params;
    return sendPost("xmsopen.dsp.xoplistmouthpay", {
        transyear:transYear
    })
    // 字段	必需	类型	描述	返回示例值
    // data	true	list	数据集
    // data.alipay	true	Double	支付宝金额
    // data.wechat	true	Double	微信金额
    // data.transAmount	true	Double	平台总交易金额
    // data.tenantNum	true	int	平台总商户数
    // data.tenantPayNum	true	int	有交易商户数
    // data.transDate	true	String	年月
    //测试用
}


/**
 * DB019 获取支付平台客户列表
 * @param params
 */
export const getListpaytenant = function (params) {
    let {date, tenantId, hotelId} = params
    return sendPost("xmsopen.dsp.xoplistpaytenant", {
        date: date,
        tenantid: tenantId,
        hotelId: hotelId
    })
}

/**
 * DB020 获取支付平台客户详情
 * @param params
 */
export const getGetpaytenantdetail = function (params) {
    let {tenantid, hotelid,year} = params
    return sendPost("xmsopen.dsp.getpaytenantdetail", {
        tenantid: tenantCode,
        hotelid: hotelid,
        transyear:year
    })
}

/**
 * DB021 获取餐饮通支付客户列表
 * @param params
 */
export const getListcyttenant = function (params) {
    let {tenantid,hotelid,date} = params
    return sendPost("xmsopen.dsp.xoplistcyttenant", {
        tenantid: tenantid,
        hotelid: hotelid,
        date: date,
    })
}

/**
 * DB022 获取餐饮通客户详情
 * @param params
 */
export const getGetcyttenantdetail = function (params) {
    let {tenantId} = params
    return sendPost("xmsopen.dsp.getcyttenantdetail", {
        tenantId: tenantId
    })
}

/**
 * DB023 获取扫码通支付客户列表
 * @param params
 */
export const getListsmttenant = function (params) {
    let {transDate} = params
    return sendPost("xmsopen.dsp.listsmttenant", {
        transDate: transDate
    })
}

/**
 * DB024 获取扫码通客户详情
 * @param params
 */
export const getGetsmttenantdetail = function (params) {
    let {tenantId} = params
    return sendPost("xmsopen.dsp.getsmttenantdetail", {
        tenantId: tenantId
    })
}

/**
 * DB025 获取月发票数据
 * @param params
 */
export const getListmouthinvoice = function (params) {
    return sendPost("xmsopen.dsp.listmouthinvoice", params)
}



/**
 * DB026 获取发票客户列表
 * @param params
 */
export const getListinvoicetenant = function (params) {
    let {transDate} = params
    return sendPost("xmsopen.dsp.listinvoicetenant", {
        transDate:transDate
    })
}

/**
 * DB027 获取发票客户详情
 * @param params
 */
export const getGetinvoicetenantdetail = function (params) {
    let {tenantId,hotelId} = params
    return sendPost("xmsopen.dsp.getinvoicetenantdetail", {
        tenantId:tenantId,
        hotelId:hotelId,
    })
}



